package com.example.nebula.config;

import com.alibaba.fastjson.JSONObject;
import com.example.nebula.exception.GraphExecuteException;
import com.example.nebula.util.R;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

@ControllerAdvice
public class GraphExceptionHandler {


    @ExceptionHandler({GraphExecuteException.class})
    public ResponseEntity<String> handleException(Exception e) {

        return ResponseEntity.status(500).body(JSONObject.toJSON(R.fail("500", e.getMessage())).toString());
    }


}